package com.joinway.admin.compact;

import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;

import com.joinway.framework.admin.bean.UserContext;
import com.joinway.framework.admin.bean.domain.AdminUser;
import com.joinway.framework.admin.bean.domain.TreeMenu;
import com.joinway.framework.admin.bean.view.UserOverviewView;
import com.joinway.framework.admin.core.bean.view.Menu;
import com.joinway.framework.admin.core.bean.view.TreeMenuView;
import com.joinway.framework.admin.core.constant.AdminWebConstants;
import com.joinway.framework.admin.core.service.AdminService;
import com.joinway.framework.admin.core.utils.UIHelper;
import com.joinway.framework.core.repository.SystemConfigRepository;
import com.joinway.framework.core.utils.FrameworkHelper;

@Service
public class CompactAdminService extends AdminService {

	@Override
	public int getPriority() {
		return 10;
	}

	@Override
	public TreeMenuView getNavigatorMenus(int userId) throws Exception {
		List<TreeMenu> trees =  qservice.findTreeMenus();
		
		TreeMenuView view = new TreeMenuView();

		String pageSuffix = systemRepository.getStringValue(SystemConfigRepository.PageRequestSuffix);
		
		List<Menu> menus = UIHelper.convert(trees, pageSuffix);
		view.setMenus(menus);

		return view;
	}

	@Override
	public UserOverviewView getUserOverviewView(int userId) throws Exception {
		UserOverviewView view = new UserOverviewView();
		view.setLoginName("test");
		view.setName("test");
		return view;
	}


}
